﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;

namespace G.Controls
{
    [TemplateVisualState(Name = "MouseOver", GroupName = "CommonStates")]
    [TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
    [TemplateVisualState(Name = "Click", GroupName = "CommonStates")]
    public class TextButton : ButtonBase
    {
        public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(TextButton), null);
        public string Text
        {
            get
            {
                return (string)this.GetValue(TextProperty);
            }
            set
            {
                this.SetValue(TextProperty, value);
            }

        }
        public static readonly DependencyProperty TextDecorationsProperty = DependencyProperty.Register("TextDecoration", typeof(TextDecorationCollection), typeof(TextButton), null);

        public TextDecorationCollection TextDecoration
        {
            get
            {
                return (TextDecorationCollection)this.GetValue(TextDecorationsProperty);
            }
            set
            {
                this.SetValue(TextDecorationsProperty, value);
            }
        }


        public TextButton()
        {
            this.DefaultStyleKey = typeof(TextButton);
        }
        protected override void OnClick()
        {
            base.OnClick();
            VisualStateManager.GoToState(this, "Click", false);
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            VisualStateManager.GoToState(this, "MouseOver", false);
        }
        protected override void OnMouseLeave(MouseEventArgs e)
        {
            base.OnMouseLeave(e);
            VisualStateManager.GoToState(this, "Normal", false);
        }
    }
}
